// src/api/student.js
import request from '@/utils/request'

/**
 * 学生管理API封装
 */

// 获取学生列表
export function getStudentList(pageNum, pageSize, orderBy, student) {
  return request({
    url: `/student/findall/${pageNum}/${pageSize}/${orderBy}`,
    method: 'post',
    data: student
  })
}

// 添加单个学生
export function addStudent(classsId, student) {
  return request({
    url: `/student/insert/${classsId}`,
    method: 'post',
    data: student
  })
}

// 批量添加学生
export function addStudentList(classsId, students) {
  return request({
    url: `/student/insertlist/${classsId}`,
    method: 'post',
    data: students
  })
}

// 更新学生
export function updateStudent(student) {
  return request({
    url: '/student/update',
    method: 'put',
    data: student
  })
}

// 删除学生
export function deleteStudent(acc) {
  return request({
    url: `/student/delete/${acc}`,
    method: 'delete'
  })
}

// 根据ID获取学生
export function getStudentById(id) {
  return request({
    url: `/student/${id}`,
    method: 'get'
  })
}